package service.impl;

import bean.Admin;
import dao.AdminDao;
import dao.impl.AdminDaoImpl;
import service.AdminService;

import java.util.List;

public class AdminServiceImpl implements AdminService {
    private AdminDao adminDao = new AdminDaoImpl();

    @Override
    public List<Admin> getAll() {
        return adminDao.getAll();
    }

    @Override
    public Admin getAdminByAdminname(String admin_name) {
        return adminDao.getAdminByAdminname(admin_name);
    }

    @Override
    public Admin login(String admin_name, String password) {
        Admin admin = adminDao.getAdminByAdminname(admin_name);
        if (admin != null && admin.getPassword().equals(password)) {
            return admin;
        }
        return null;
    }
}
